﻿using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

namespace AutoTest.Framework.Module
{
    /// <summary>
    /// 模块接口定义
    /// </summary>
    public interface IModule
    {
        /// <summary>
        /// 初始化操作
        /// </summary>
        /// <param name="model"></param>
        void PreInit(BootParams model);
        /// <summary>
        /// 注册完成以后会调用此方法
        /// </summary>
        void Init();
        /// <summary>
        /// IOC，Buid以后会循环调用此方法
        /// </summary>
        void PostInit(IApplicationBuilder app);
        /// <summary>
        /// 模块类型：定义了三种模块类型，一种框架核心模块，最先加载，二是封装各种组建模块，第二加载，三是业务程序模块，最后加载
        /// </summary>
        ModuleType ModuleType { get; }
        int Sort { get; }
    }
    /// <summary>
    /// 框架模块
    /// </summary>
    public interface IFrameModule : IModule { }
    /// <summary>
    /// 程序添加模块
    /// </summary>
    public interface IProgrameModule : IModule{ }
    /// <summary>
    ///  组件模块
    /// </summary>
    public interface IComponentModule : IModule { }

    public enum ModuleType
    {
        /// <summary>
        /// 框架的核心模块
        /// </summary>
        FrameModule = 100,
        /// <summary>
        /// 框架的组建模块
        /// </summary>
        ComponentModule = 200,
        /// <summary>
        /// 业务程序模块
        /// </summary>
        ProgrameModule = 300
    }
}
